package com.guigu.youxuan.controller;

import com.guigu.youxuan.pojo.GoodsImg;
import com.guigu.youxuan.service.IGoodsImgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author liweixin
 * @since 2024-05-15
 */
@CrossOrigin
@RestController
@RequestMapping("/goodsImg")
public class GoodsImgController {

    @Autowired
    private IGoodsImgService goodsImgService;

    /**
     * 修改商品的图片回显查询
     * @param gid
     * @return
     */
    @RequestMapping("/queryGoodsImgByGId/{gid}")
    public GoodsImg queryGoodsImgByGId(@PathVariable Long gid) {
        GoodsImg goodsImg = goodsImgService.queryGoodsImgByGId(gid);
        return goodsImg;
    }

    /**
     * ID查询商品详情页信息
     * @param id
     * @return
     */
    @RequestMapping("/queryGoodsImgByGId2/{id}")
    @ResponseBody
    public List<GoodsImg> selgoods(@PathVariable int id){
        List<GoodsImg> goodsImgById = goodsImgService.queryGoodsImgByGId2(id);
        return goodsImgById;
    }
}
